﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%var checkfrom = v.data("checkfrom") as String; %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" language="JavaScript">
    var filemanage_js_upfile_zoomsize = "_{filemanage_js_upfile_zoomsize}";
    var filemanage_js_upfile_driname_err = "_{filemanage_js_upfile_driname_err}";
    var filemanage_js_upfile_ok = "_{filemanage_js_upfile_ok}";
    var filemanage_js_upfile_no = "_{filemanage_js_upfile_no}";
    var fheight = "#{fheight}";
	$(window).load(function(){
		var h = parseInt(fheight);
		$('#mainbodybottonauto').css({height:h-39});
		var options = {
			beforeSubmit: formverify,
			success:saveResponse
		}
		$('#upfile').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	});




	function formverify(formData, jqForm, options) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['upfilepath']=='') {
			document.upfile.upfilepath.focus();
			alert(filemanage_js_upfile_driname_err);
			return false;
		}
	}

	function saveResponse(options){
		var inputstr="<td class=\"trtitle02\" id=\"upfilepath\"><input type=\"file\" name=\"upfilepath\" maxlength=\"200\" size=\"50\" class=\"infoInput\"></td>";
		$("#upfilepath").replaceWith(inputstr);

		var strarray = options.split('|');

		if (strarray[1]!=undefined){


			$("#resulttable").removeClass('displaynone');

			if (strarray[1]=='img'){
				var outfile=strarray[3] ? strarray[3] : strarray[0];
				if (strarray[2]=='1'){
					var upresult='<td class="trtitle02" id="upresult"><a onclick="javascript:refile(\''+outfile+'\',\''+strarray[2]+'\');" href="#body" hidefocus="true"><img src="../../..' + strarray[0] + '" width="100"></a></td>';
				}else{
					var upresult='<td class="trtitle02" id="upresult"><a onclick="javascript:refile(\''+outfile+'\',\''+strarray[2]+'\');" href="#body" hidefocus="true"><img src="../../..' + strarray[0] + '" height="100"></a></td>';
				}
				$("#upresult").replaceWith(upresult);
			}else{
				var upresult='<td class="trtitle02" id="upresult"><a class="lnglist" onclick="javascript:refile(\''+strarray[0]+'\',\''+strarray[2]+'\');" href="#body" hidefocus="true">' + strarray[0] + '</a></td>';
				$("#upresult").replaceWith(upresult);
			}
			$("#title").val("");
			alert(filemanage_js_upfile_ok);
		}else{
			alert(strarray[0]);
		}
	}
	function refile(filename, iswidth) {
        <%if(checkfrom =="picshow"){%>
	    parent.refile(filename, iswidth);
	    <%}else if (checkfrom == "function") {%>
	    parent.refile(filename, iswidth);
	    <%}else{%>
	    parent.refile(filename.substring(1, filename.length), iswidth);
        <%}%>
	}
	document.oncontextmenu=new Function('event.returnValue=false;');
	document.onselectstart=new Function('event.returnValue=false;');
</script>
</head>

<body class="bodyflow">
<form name="upfile" id="upfile" method="post" enctype="multipart/form-data" action="#{ActionLink}?checkfrom=#{checkfrom}">
<input type="hidden" name="path" id="path" value="#{path}"/>
<input type="hidden" name="MAX_FILE_SIZE" id="maxfile" value="#{maxfile}" />
<input type="hidden" name="img_width" value="#{img_width}" />
<input type="hidden" name="img_height" value="#{img_height}" />
<input type="hidden" name="filetype" value="#{filetype}" />
<input type="hidden" name="lng" value="#{lng}" />
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="maneditcontent">
			<table class="formtablewin">
				<tr class="trstyle2">
					<td class="trtitle01">_{filemanage_file_upfile_dirname}</td>
					<td class="trtitle02" id="upfilepath"><input type="file" name="upfilepath" maxlength="200" size="50" class="infoInput"></td>
				</tr>
                <%var filetype = v.data("filetype").ToString(); %>
                <%if(filetype == "img"){ %>
				<tr class="trstyle2">
					<td class="trtitle01">_{filemanage_file_upfile_isamid_str}</td>
					<td class="trtitle02">
						<input type="radio" value="1" name="isamid" onclick="ondisplayother('isdirnamediv','trstyle2 displaytrue','isdirnamediv2','trstyle2 displaynone')"/> _{filemanage_file_upfile_isamid1}&nbsp;
						<input type="radio" value="0" name="isamid" onclick="ondisplayother('isdirnamediv','trstyle2 displaynone','isdirnamediv2','trstyle2 displaytrue')" checked="checked"/> _{filemanage_file_upfile_isamid2}
					</td>
				</tr>
				<tr class="trstyle2  displaynone" id="isdirnamediv">
					<td class="trtitle01">_{filemanage_file_upfile_isamidname}</td>
					<td class="trtitle02"><input type="text" name="title" id="title" maxlength="150" size="50" class="infoInput" /></td>
				</tr>
				<tr class="trstyle2" id="isdirnamediv2">
					<td class="trtitle01">_{filemanage_file_upfile_amid}</td>
					<td class="trtitle02">
						<select size="1" name="amid" id="amid">
							<option value="0">_{filemanage_file_upfile_amid_option}</option>
                            <%var list = v.data("list") as List<Album_Images>; %>
                            <%foreach(var row in list){ %>
							<option value="<%=row.Id %>"><%=row.title %></option>
							<%} %>
						</select>
					</td>
				</tr>
                <%var img_iswater = Convert.ToInt32(v.data("img_iswater")); %>
				<tr class="trstyle2">
					<td class="trtitle01"></td>
					<td class="trtitle02">
						<input type="radio" value="0" name="img_iswater" <%if(img_iswater ==0){ %> checked="checked"<%} %> /> _{filemanage_file_upfile_img_iswater0} &nbsp;&nbsp;
						<input type="radio" value="1" name="img_iswater"<%if(img_iswater ==1){ %> checked="checked"<%} %> /> _{filemanage_file_upfile_img_iswater}&nbsp;&nbsp;
						<input type="radio" value="2" name="img_iswater"<%if(img_iswater ==2){ %> checked="checked"<%} %> /> _{filemanage_file_upfile_img_iswater2}
					</td>
				</tr>
                <%var img_issmallpic = Convert.ToInt32(v.data("img_issmallpic")); %>
				<tr class="trstyle2">
					<td class="trtitle01"></td>
					<td class="trtitle02"><input type="checkbox" value="1" name="img_issmallpic"<%if(img_issmallpic ==1){ %> checked="checked"<%} %>> _{filemanage_file_upfile_zoom_type}</td>
				</tr>
				<%} %>
				<tr class="trstyle2">
					<td class="trtitle01"></td>
					<td class="trtitle02">1、_{filemanage_file_upfile_dirname_mess}#{maxfile2}，_{filemanage_file_upfile_type_mess}#{upfile_pictype}；<br />2、_{filemanage_file_upfile_mess}#{path}</td>
				</tr>
			</table>
			<table class="formtablewin displaynone" id="resulttable">
				<tr class="trstyle3">
					<td class="trtitle01">_{filemanage_file_select}</td>
					<td class="trtitle02" id="upresult"><img src="#{path.img}ybb/images/pic.png" width="100px" height="100px"></td>
				</tr>
				<tr class="trstyle2">
					<td class="trtitle01"></td>
					<td class="trtitle02">_{filemanage_file_upfile_resple_mess}</td>
				</tr>
			</table>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr id="bottonsubmit">
				<td id="center">
					<table border="0" style="margin: 0 auto;">
						<tr >
							<td><input type="submit" name="Submit" id="submitbotton" value="_{botton_upfile}" class="buttonface" title="_{botton_upfile}"/></td>
							<td style="padding:0 5px 0 5px;"><input type="reset" name="reset" onClick="javascript:location.reload();" id="refresh" value="_{refresh_botton_photoab}" class="buttonface"  title="_{refresh_botton_photoab}" /></td>
							<td><input type="reset" name="reset" onClick="javascript:parent.resetwindow();" id="release" value="_{botton_upfile_reset}" class="buttonface"  title="_{botton_upfile_reset}" /></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>
</html>